/**
 * Created By zhangQ 2018/2/19
 * 主运单api
 */
import axiosUtils from '@api/env/axiosEnv'

let customAxios = axiosUtils._initAxios()

// 弃用
export function getMainOrder (param) {
  return customAxios({
    url: '/main/order/getMainOrderList',
    method: 'post',
    data: {
      status: param.status,
      page: param.page,
      pageSize: 10
    }
  })
}

/**
 * TODO(分页获得物流检测信息)
 * @auther zhangQ
 * @date 2018/3/13 18:18
 **/
export function getMainOrderByPage (param) {
  return customAxios({
    url: '/main/order/getMainOrderListByPage',
    method: 'post',
    data: param
  })
}

/**
 * TODO(覆盖版获取主运单列表分页)
 * @auther zhangQ
 * @date 2018/3/13 18:18
 **/
export function queryMainOrderListByPage (param) {
  return customAxios({
    url: '/main/order/queryMainOrderListByPage',
    method: 'post',
    data: param
  })
}

export function dispatchRemove (param) {
  return customAxios({
    url: '/main/station/dispatchRemove',
    method: 'post',
    data: param
  })
}

export function getOrderDetail (param) {
  return customAxios({
    url: '/main/order/getMainOrderInfoByOrderNo',
    method: 'post',
    data: {
      orderNo: param.orderNo,
      transportType: param.transportType
    }
  })
}

export function getFleetOrderByMainOrderNo (param) {
  return customAxios({
    url: '/main/station/getFleetOrderByMainOrderNo',
    method: 'post',
    data: {
      mainOrderNo: param.mainOrderNo
    }
  })
}

export function getChangjiPowerStationOrderDetail (param) {
  return customAxios({
    url: '/main/ChangjiPowerStation/getMainOrderInfoByOrderNo',
    method: 'post',
    data: {
      orderNo: param.orderNo,
      mode: param.mode
    }
  })
}

/**
 * TODO(根据主运单查询子运单信息)
 * @auther zhangQ
 * @date 2018/4/3 11:08
 */
export function findByMainOrderNoForDispatchState (param) {
  return customAxios({
    url: '/main/order/findByMainOrderNoForDispatchState',
    method: 'post',
    data: {
      MainOrderNo: param.orderNo
    }
  })
}

/**
 * TODO(根据主运单查询子运单信息)
 * @auther zhangQ
 * @date 2018/4/3 11:08
 */
export function findByMainOrderNoForDispatchStateFG (param) {
  return customAxios({
    url: '/main/order/findByMainOrderNoForDispatchStateFG',
    method: 'post',
    data: {
      MainOrderNo: param.orderNo
    }
  })
}

export function getProductInfo () {
  return customAxios({
    url: '/getProductInfo',
    method: 'post'
  })
}

export function getNoticeListByMainOrderNo (param) {
  return customAxios({
    url: '/main/station/getNoticeListByMainOrderNo',
    method: 'post',
    data: {
      mainOrderNo: param.orderNo
    }
  })
}

export function quertDispatched (param) {
  return customAxios({
    url: '/main/station/quertDispatched1',
    method: 'post',
    data: param
  })
}

export function dispatchCancelToGroup (param) {
  return customAxios({
    url: '/main/station/dispatchCancelToGroup',
    method: 'post',
    data: param
  })
}

/**
 * 查询自运单信息
 * @param param
 * @returns {*}
 */
export function querySubOrderByMainOrder (param) {
  return customAxios({
    url: '/main/order/querySubOrderByMainOrder',
    method: 'post',
    data: param
  })
}

export function assignmentToFleet (param) {
  return customAxios({
    url: '/main/station/assignmentToFleet',
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data: param
  })
}

export function assignmentToFleetToGroup (param) {
  return customAxios({
    url: '/main/station/assignmentToFleetToGroup',
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data: param
  })
}

// 获取看板数据
export function getBoardData () {
  return customAxios({
    url: '/main/getBoardData',
    method: 'post'
  })
}

// 获取看板数据
export function getBoardData2 () {
  return customAxios({
    url: '/main/getBoardData2',
    method: 'post'
  })
}

export function assignmentForDriver (param) {
  return customAxios({
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    url: '/main/station/assignmentForDriver',
    method: 'post',
    data: param
  })
}

// 车队给司机派单（未指定司机，多对多）
export function assignmentForNotDriverKel (param) {
  return customAxios({
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    url: '/main/fleet/assignmentForNotDriverKel',
    method: 'post',
    data: param
  })
}

// 库尔勒车队撤销派单
export function assignmentForDriverRemove (param) {
  return customAxios({
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    url: '/main/station/assignmentForDriverRemove',
    method: 'post',
    data: param
  })
}

// 库尔勒车队撤销派单
export function assignmentForDriverRemoveKel (param) {
  return customAxios({
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    url: '/main/fleet/assignmentForDriverRemoveKel',
    method: 'post',
    data: param
  })
}

// 库尔勒车队撤销派单
export function addDriverSave (param) {
  return customAxios({
    url: '/main/fleet/addDriverSave',
    method: 'post',
    data: param
  })
}

// 绑定子运单到车队
export function bindSubOrderNoWithUser (param) {
  return customAxios({
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    url: '/main/fleet/bindSubOrderNoWithUser',
    method: 'post',
    data: param
  })
}

// 解除绑定子运单到车队
export function unbindSubOrderNoWithUser (param) {
  return customAxios({
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    url: '/main/fleet/unbindSubOrderNoWithUser',
    method: 'post',
    data: param
  })
}

// 自动派单
export function autoDispatcher (param) {
  return customAxios({
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    url: '/main/autoDispatcher',
    method: 'post',
    data: param
  })
}

// 自动派单列表
export function getAutoDispatcherList (param) {
  return customAxios({
    url: '/main/autoDispatcher/getAutoDispatcherList',
    method: 'post',
    data: param
  })
}

// 自动派单编辑
export function editAutoDispatcher (param) {
  return customAxios({
    url: '/main/autoDispatcher/editAutoDispatcher',
    method: 'post',
    data: param
  })
}

// 自动派单验证
export function detectAutoDispatcherConfig (param) {
  return customAxios({
    url: '/main/autoDispatcher/detectAutoDispatcherConfig',
    method: 'post',
    data: param
  })
}

// 自动派单删除
export function deleteAutoDispatcher (param) {
  return customAxios({
    url: '/main/autoDispatcher/deleteAutoDispatcher',
    method: 'post',
    data: param
  })
}

// 场站给车队派单 3.0
export function dispatchToFleetOrder (param) {
  return customAxios({
    url: 'main/XlFleetOrder/dispatchToFleetOrder',
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data: param
  })
}

// 场站给车队派单 3.0
export function dispatchToFleetOrder2 (param) {
  return customAxios({
    url: 'main/XlFleetOrder/dispatchToFleetOrder2',
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data: param
  })
}

// 场站显示已分组派单列表 3.0
export function quertDispatchedV3 (param) {
  return customAxios({
    url: '/main/station/v3/quertDispatched1',
    method: 'post',
    data: param
  })
}

// 场站分组派单撤销 3.0
export function dispatchCancelToGroupV3 (param) {
  return customAxios({
    url: '/main/fleetOrder/dispatchCancelToGroup',
    method: 'post',
    data: param
  })
}

export function dispatchCancelToGroup2 (param) {
  return customAxios({
    url: '/main/fleetOrder/dispatchCancelToGroup2',
    method: 'post',
    data: param
  })
}

// 场站整列派单撤销 3.0
export function dispatchRemoveV3 (param) {
  return customAxios({
    url: '/main/fleetOrder/dispatchRemove',
    method: 'post',
    data: param
  })
}

export function ChangjiPowerStationGetMainOrderListByPage (param) {
  return customAxios({
    url: '/main/ChangjiPowerStation/getMainOrderListByPage',
    method: 'post',
    data: param
  })
}

export function getPredictionStationList (param) {
  return customAxios({
    url: '/main/PowerStation/getPredictionStationList',
    method: 'post',
    data: param
  })
}

// 获取总车队列表
export function queryFleetOrderListByPage (param) {
  return customAxios({
    url: '/main/fleetOrder/queryFleetOrderListByPage',
    method: 'post',
    data: param
  })
}

// 总车队子运单派单列表
export function getFleetOrderDetailList (param) {
  return customAxios({
    url: '/main/XlTotalFleetOrder/getFleetOrderDetailList',
    method: 'post',
    data: param
  })
}

// 总车队给子车队派单列表
export function assignmentToSubFleet (param) {
  return customAxios({
    url: '/main/XlTotalFleetOrder/assignmentToSubFleet',
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data: param
  })
}

// 总车队显示已分组派单列表
export function queryDispatched (param) {
  return customAxios({
    url: '/main/XlTotalFleetOrder/queryDispatched',
    method: 'post',
    data: param
  })
}

// 总车队分组撤销派单
export function dispatchCancelToGroupFleets (param) {
  return customAxios({
    url: '/main/XlTotalFleetOrder/dispatchCancelToGroup',
    method: 'post',
    data: param
  })
}
